﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using TaskQueueDemo.ViewModels;
using TaskStatus = TaskQueueDemo.ViewModel.TaskStatus;

namespace TaskQueueDemo.Converters
{

    public class StatusToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is TaskStatus status)
            {
                return status switch
                {
                    TaskStatus.Pending => Brushes.Gray,
                    TaskStatus.Running => Brushes.Blue,
                    TaskStatus.Completed => Brushes.Green,
                    TaskStatus.Failed => Brushes.Red,
                    _ => Brushes.Black
                };
            }
            return Brushes.Black;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}